package com.linln.modules.system.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linln.common.enums.StatusEnum;
import com.linln.common.utils.StatusUtil;
import com.linln.component.excel.annotation.Excel;
import com.linln.component.excel.enums.ExcelType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author 小懒虫
 * @date 2018/8/14
 */
@Data
@Entity
@Table(name = "pcs_msg") // 修改: pcs_dep -> pcs_msg
@ToString(exclude = {"dept", "roles"})
@EqualsAndHashCode(exclude = {"dept", "roles"})
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update pcs_msg" + StatusUtil.SLICE_DELETE) // 修改: pcs_dep -> pcs_msg
@Where(clause = StatusUtil.NOT_DELETE)
@Excel("消息") // 修改: 科室数据 -> 消息
public class Msg implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Excel(value = "ID", type = ExcelType.EXPORT)
    private Long id;

    @CreatedDate
    @Excel("创建时间")
    private Date createTime;

    private String createTimeStr;

    @LastModifiedDate
    @Excel("更新时间")
    private Date updateTime;

    @JsonIgnore
    private Long createUser;

    @JsonIgnore
    private Long updateUser;

    @JsonIgnore
    private Byte status = StatusEnum.OK.getCode();

    @Excel("通知类型 1 接单成功通知 2护理公司确认通知 3 服务完成通知 4余额不足终止通知 5 陪护公司结束订单通知")
    private Byte type; // 新增字段

    @Excel("通知内容")
    private String content; // 新增字段

    @Excel("患者ID")
    private Long patientId; // 新增字段

    @Excel("订单号")
    private String sn; // 新增字段

}
